@include('admin.header')
<title>添加管理员 - 管理员管理 - H-ui.admin v2.4</title>
<meta name="keywords" content="H-ui.admin v3.0,H-ui网站后台模版,后台模版下载,后台管理系统模版,HTML后台模版下载">
<meta name="description" content="H-ui.admin v3.0，是一款由国人开发的轻量级扁平化网站后台模板，完全免费开源的网站后台管理系统模版，适合中小型CMS后台系统。">
</head>
<body>
<article class="page-container">
	<form class="form form-horizontal" action="/admin/goods" method="post" id="form-admin-add" enctype="multipart/form-data">
	{{ csrf_field() }}
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>产品名称：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" value="" placeholder="" id="name" name="name">
		</div>
	</div>

	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>产品库存：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" value="" placeholder="" id="num" name="num">
		</div>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>产品价格：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" value="" placeholder="" id="price" name="price">
		</div>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3">是否上架：</label>
		<div class="formControls col-xs-8 col-sm-9"> <span class="select-box" style="width:150px;">
			<select class="select" name="status" size="1" id="status">
				<option value="0" selected>上架</option>
				<option value="1">不上架</option>
			</select>
			</span> </div>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3">推荐新书：</label>
		<div class="formControls col-xs-8 col-sm-9"> <span class="select-box" style="width:150px;">
			<select class="select" name="new" size="1" id="status">
				<option value="0" selected>不推荐</option>
				<option value="1">推荐</option>
			</select>
			</span> </div>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3">推荐热门：</label>
		<div class="formControls col-xs-8 col-sm-9"> <span class="select-box" style="width:150px;">
			<select class="select" name="hot" size="1" id="status">
				<option value="0" selected>不推荐</option>
				<option value="1">推荐</option>
			</select>
			</span> </div>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3">所属栏目：</label>
		<div class="formControls col-xs-8 col-sm-9"> <span class="select-box" style="width:150px;">
			<select class="select" name="cat_id" size="1" id="cat_id">
			@foreach($cat as $val)
				<option value="{{$val->id}}">
				<?php echo str_repeat('|---',$val->lev) ?>{{ $val->cat_name }}
				</option>
			@endforeach
				
			</select>
			</span> </div>
	</div>
	<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">产品摘要：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<textarea name="des" cols="" rows="" class="textarea"  placeholder="说点什么...最少输入10个字符" datatype="*10-100" dragonfly="true" nullmsg="备注不能为空！" onKeyUp="$.Huitextarealength(this,200)"></textarea>
				<p class="textarea-numberbar"><em class="textarea-length">0</em>/100</p>
			</div>
		</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>封面图：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="file" class="input-text" value="" placeholder="" id="photo" name="photo">
		</div>
	</div>	

	<div class="row cl">
		<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
			<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
		</div>
	</div>
	</form>
</article>
@include('admin.footer')

<!--请在下方写此页面业务相关的脚本-->

<script type="text/javascript" src="/admin/lib/jquery.validation/1.14.0/jquery.validate.js"></script> 
<script type="text/javascript" src="/admin/lib/jquery.validation/1.14.0/validate-methods.js"></script> 
<script type="text/javascript" src="/admin/lib/jquery.validation/1.14.0/messages_zh.js"></script> 
 <script type="text/javascript">
$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	
	$("#form-admin-add").validate({
		rules:{
			name:{
				required:true,
				maxlength:10
			},
			num:{
				required:true,
				maxlength:10
			},
			price:{
				required:true,
				maxlength:10
			},
			status:{
				required:true,
			},
			des:{
				required:true,
				maxlength:100
			},
		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		/*submitHandler:function(form){
        $.ajaxSetup({
         headers: { 'X-CSRF-Token' : $('meta[name=_token]').attr('content') }
        });


        var name = $("#catName").val();
        var num = $("#catNum").val();
        var price = $("#catPrice").val();
        var cat_id = $("#cat_id").val();
        var des = $("#catDes").val();
        var status = $("#catStatus").val();
        var photo = $("#photo").val();
     	document.write(name);
        return;
			$(form).ajaxSubmit({
				type: 'post',
				url:"/admin/goods",
				 contentType: false,
            processData: false,
				data:{
					'name':name,
					'num':num,
					'price':price,
					'cat_id':cat_id,
					'des':des,
					'status':status,
					'photo':photo
				},


				success: function(data){

						layer.msg('添加成功!',{icon:1,time:1000});
					
					
				},
                error: function(XmlHttpRequest, textStatus, errorThrown){
					layer.msg('error!',{icon:1,time:1000});
				}
			});
			
		
			var index = parent.layer.getFrameIndex(window.name);
			parent.$('.btn-refresh').click();
			parent.layer.close(index);
		}*/
	});
});
 </script> 
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>